package com.wineryviewer.client;


import com.google.gwt.json.client.JSONObject;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;

public class OfferMarker extends Marker {
  public String name;
  public String address;
  public String city;
  public String state;
  public String zip;
  public String phone;
  public String url;
  public String logo;
  
  
  public OfferMarker(JSONObject dto) {
    super(LatLng.fromUrlValue(dto.get("latitude").isString().stringValue() +
        "," + dto.get("longitude").isString().stringValue()));
    name = dto.get("name").isString().stringValue();
    address = dto.get("address1").isString().stringValue();
    city = dto.get("city").isString().stringValue();
    state = dto.get("state").isString().stringValue();
    zip = dto.get("zip").isString().stringValue();
    phone = dto.get("phoneno").isString().stringValue();
    url = dto.get("url").isString().stringValue();
    logo = dto.get("logo").isString().stringValue();
  }
  
  public Widget getInfoWindowWidget() {
    // Image logoImg = new Image("http://usa.visa.com" + logo);
    // logoImg.setHeight("47px"); logoImg.setWidth("83px");
    HTML info =  new HTML("<b>" + name + "</b>&nbsp;&nbsp;&nbsp;&nbsp;" + "<br/>" + phone + "<br/><a href='" + url + "'>website</a>");
    return info;
  }
}

